# from selenium.webdriver import Chrome
# driver=Chrome()
# driver.get("http://www.baidu.com/")
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
# 对谷歌进行测试1
chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')

driver = webdriver.Chrome(options=chrome_options)
driver.get("https://www.google.com")
print(driver.title)
driver.quit()
# 对谷歌进行测试2
from selenium import webdriver
from selenium.webdriver.common.by import By
wd = webdriver.Chrome()
wd.get("https://www.baidu.com/")
wd.implicitly_wait(3)

wd.quit()



#万茂洁 2022900113
#
# from time import sleep
# from lxml import etree
# from pyparsing import nums
# from selenium import webdriver
# import pymysql
#
# def getData():
#     edge = webdriver.Edge()
#     url = 'https://quote.eastmoney.com/zs000300.html'
#     edge.get(url)
#     sleep(3);#请求时间
#     page=edge.page_source#获取页面资源
#     html=etree.HTML(page)#格式化，用xpath进行解析
#     names=html.xpath("//table[@class='zjl1']//tr/td/text()")
#     nums=html.xpath("//table[@class='zjl1']//tr/td/span/text()")
#     # print(names,nums)
#     savaData(names,nums)
# def savaData(names,nums):
#     conn = pymysql.connect(host='localhost', port=3306, user='root', password='root', database='cjxy')
#     cursor=conn.cursor();
#     for i in range (0,len(names)):
#         name = names[i]
#         num = nums[i]
#         print(name,num)
#         #保存到数据库
#         params=[name,num]
#         sql='insert into dfcf (name,num) values (%s,%s)'
#
#         cursor.execute(sql,params);
#         conn.commit()
#     conn.close()
#
# if __name__ == '__main__':#敲main就会有提示
#     getData();


# from time import sleep
# from lxml import etree
# from pyparsing import nums
# from selenium import webdriver
# import pymysql
#
# def getData():
#     edge = webdriver.Edge()
#     url = 'https://data.eastmoney.com/zjlx/dpzjlx.html'
#     edge.get(url)
#     sleep(10);#请求时间
#     page=edge.page_source#获取页面资源
#     html=etree.HTML(page)#格式化，用xpath进行解析
#     net_amounts =html.xpath("//div[@class='dataview']//tr/td[4]/text()")  # 主力流入的净额
#     net_percentages = html.xpath("//div[@class='dataview']//tr/td[5]/text()")  # 主力流入的净占比
#     main_net_inflows = html.xpath("//table[@class='table1']//tr//td[3]/text()")  # 今日主力净流入
#     large_net_inflows = html.xpath("//table[@class='table1']//tr[2]//td[3]/text()")  # 今日超大单净流入
#     big_net_inflows = html.xpath("//table[@class='table1']//tr[3]//td[3]/text()")  # 今日大单净流入
#     medium_net_inflows = html.xpath("//table[@class='table1']//tr[4]//td[3]/text()")  # 今日中单净流入
#     small_net_inflows = html.xpath("//table[@class='table1']//tr[5]//td[3]/text()")  # 今日小单净流入
#     print(net_amounts,net_percentages,main_net_inflows,large_net_inflows,big_net_inflows,medium_net_inflows,small_net_inflows)
#     savaData(net_amounts,net_percentages,main_net_inflows,large_net_inflows,big_net_inflows,medium_net_inflows,small_net_inflows)
# def savaData(net_amounts,net_percentages,main_net_inflows,large_net_inflows,big_net_inflows,medium_net_inflows,small_net_inflows):
#     conn = pymysql.connect(host='111.229.116.141', port=3306, user='yfzx', password='xf@yfzx', database='stock_strategy')
#     cursor=conn.cursor();
#     for i in range (0,len(large_net_inflows)):
#         net_amount = net_amounts[i]
#         net_percentage = net_percentages[i]
#         main_net_inflow = main_net_inflows[i]
#         large_net_inflow = large_net_inflows[i]
#         big_net_inflow = big_net_inflows[i]
#         medium_net_inflow = medium_net_inflows[i]
#         small_net_inflow = small_net_inflows[i]
#         #保存到数据库
#         params=[net_amount,net_percentage,main_net_inflow,large_net_inflow,big_net_inflow,medium_net_inflow,small_net_inflow]
#         sql='insert into money_flow_daily (net_amount,net_percentage,main_net_inflow,large_net_inflow,big_net_inflow,medium_net_inflow,small_net_inflow) values (%s,%s,%s,%s,%s,%s,%s)'
#         cursor.execute(sql,params);
#         conn.commit()
#     conn.close()
#
# if __name__ == '__main__':#敲main就会有提示
#     getData();